home *** CD-ROM | disk | FTP | other *** search
/ Java Developer's Companion / Java Developer's Companion.iso / Javacup / IN231VFD.TAR / internet / IN231VFD / House.java < prev    next >
Text File  |  1996-05-21  |  1KB  |  51 lines

  1. //    House.java - Object representing a single house listing
  2. //
  3. //    Copyright (C) 1996 by Dale Gass
  4. //    Non-exclusive license granted to MKS, Inc.
  5. //
  6.  
  7. import java.lang.*;
  8. import java.util.*;
  9. import java.awt.*;
  10. import java.net.*;
  11. import java.applet.*;
  12.  
  13. public class House {
  14.     String  describe;    // Description
  15.     String  area;    // Location
  16.     int     price;    // Price
  17.     int     beds;    // # bedrooms
  18.     boolean view;    // Are floor plans and camera views available?
  19.     String  code;    // Prefix code for associated files
  20.  
  21.     // Constructor
  22.  
  23.     public House(String d, String a, int p, int b, boolean v, String c) {
  24.     describe = d;
  25.     area     = a;
  26.     price    = p;
  27.     beds     = b;
  28.     view     = v;
  29.     code     = c;
  30.     }
  31.  
  32.     // Retrieve the various components
  33.  
  34.     public String  getDesc()  { return describe; }
  35.     public boolean hasView()  { return view;     }
  36.     public int     getPrice() { return price;    }
  37.     public String  getCode()  { return code;     }
  38.     public String  getArea()  { return area;     }
  39.     public int     getBeds()  { return beds;     }
  40.  
  41.     // Show summary string description of listing
  42.  
  43.     public String  toString() {
  44.     String r = "$"+price+" "+area+", "+beds+" bedroom " + describe;
  45.     if (view) {
  46.         r += ", Online Viewing Available";
  47.     }
  48.     return (r);
  49.     }
  50. }
  51.